'use strict';
var cmsControllers = angular.module('cmsControllers');

cmsControllers.controller('TemplateCtrl', ['$rootScope', '$scope', 'Nav', '$modalInstance', 'TemplateOpt',
        function ($rootScope, $scope, Nav, $modalInstance, TemplateOpt) {

    var json = TemplateOpt.opt({action: 'queryTemplateByComponent', component: $rootScope.CurrentSub.code}, function () {
        $scope.templateItems = json.data.templates;
    });

    $scope.selectTemplate =  function () {
        console.log('TemplateCtrl->selectTemplate');
    };

    $scope.ok = function () {
        //$modalInstance.close($scope.selected.item);
        console.log('ok');
    };
    $scope.close = function () {
        $modalInstance.dismiss('close');

        Nav.refreshPreview();
    };
}]);
